Home Java Docker
Home     Java

Java Topic

What is Java
History of Java
Freature of Java
Difference Between Java & C++
Java Environment Set Up
Java Hello World Program & its Internal Process
Java Hello World Program
JDK, JRE and JVM
Java Variables
Java Data Types & Unicode System
Java Operators
Java Keywords
Java Control Statements
Java if else
Java switch
Java for loop
Java While loop
Java Do While loop
Java break
Java continue
Java Oops Concept
Java Object & Class
Java Method
Java Constructor
Java Static Keyword
Java this Keyword
Java Inheritance
Java Hybrid Inheritance
Aggregation(HAS-A)
Java Polymorphism
Java method overloading
Java method overriding
Java Runtime polymorphism
Java Dynamic Binding
Super keyword
Final keyword
Difference Between method overloading and method overriding
Java Abstraction
Java Interface
Abstract class vs Interface
Java Encapsulation
Java Package
Java Access Modifiers
covariant return type
Instance initializer block
Java instanceof operator
Object Cloning in Java
Wrapper classes in Java
Java Strictfp Keyword
Recursion in Java
Java Command Line Arguments
Difference between object and class
Java String
Java String Class
Java Immutable String
Java Immutable Class
String Buffer
String Builder
String Buffer vs String
String Builder vs String Buffer
String Tokenizer in Java
Java Array
Java Exceptions Handling
Java Try-Catch block
Java Multiply Catch Block
Java Finally Block
Java Throws Keyword
Java Throw Keyword
Java Exception Propagation
Java Throw vs Throws
Final vs Finally vs Finalize
Exception Handling With Method Overridding
Java Multithreading
Lifecycle and States of a Thread in Java
How to create a thread in Java
Thread Scheduler in Java
Sleeping a thread in Java
Calling run() method
Joining a thread in Java
Naming a thread in Java
Thread Priority
Daemon Thread
Thread Pool
Thread Group
Shutdown hook
Multitasking vs Multithreading
Garbage Collection
RunTime Class
Java Synchronization
Synchronized block in Java
Static Synchronization in Java
Deadlock in Java
Inter Thread Communication in Java
Interrupting Thread in Java
Reentrant Monitor in Java
Java Applet
Animation in Applet
EventHandling in Applet
Display image in Applet
Displaying Graphics in Applet
Parameter in Applet
Java 8 Features
Java Lambda Expressions
Method References
Functional Interfaces
Java 8 Stream
Base64 Encode Decode
Default Method
for Each() Method
Collectors class
String Joiner Class
Optional Class
JavaScript Nashron
Parallel Array Sort
Type Interface
Parameter Reflection
Type and Repeating Annotations
JDBC Improvements

Java Naming Convention

    When choosing names for your identifiers, such as class, package, variable, constant, method, etc., you should adhere to the Java naming standard.

    It is not required to do so, though. Convention rather than rule is how it is known. Several Java communities, such as Sun Microsystems and Netscape, have recommended these norms.

    The Java naming convention is used for all of the classes, interfaces, packages, methods, and fields in the Java programming language. Failure to adhere to these norms might result in muddled or incorrect code.



Table Of Content

  • Java Naming Convention
  • Naming Conventions of the Some Identifiers
  • Naming Comvention use in java



Naming Conventions of the Some Identifiers

The common naming conventions applied to the various identifiers are displayed in the table below.


Variable

  • It should begin with a lowercase letter.
  • The special characters & (ampersand), $ (dollar), and should not be used as the first character (underscore).
  • If the name is long, start it with a lowercase letter, then an uppercase letter, as in firstName, lastName.
  • Avoid using variables with only one character, like x, y, or z.

Example

public class Student {  
      int id; 
    // your code  
  } 


Class

  • Class names should to be nouns with the initial letter of each internal word capitalised and in mixed case.
  • you should use appropriate words, instead of acronyms.
  • Attempt to keep your class names short and simple.

Example

public class Student {  
    // your code  
  } 





Interface

  • Interface should start with the uppercase letter
  • you should use appropriate words, instead of acronyms.
  • An adjective, such as Runnable, Remote, or ActionListener, should be used.

Example

interface Printable {  
    // your code  
  } 


Method

  • Methods should be verbs e.g main(), println().
  • If the name is long, start it with a lowercase letter, then an uppercase letter, as in firstName, lastName. e.g getBackground();

Example

 class Student {  
    void shape(){
    // your code  
      } 
  } 




Package

  • Package should be a lowercase letter such as java, lang.
  • Dots (.) should be used to separate words in names with multiple words, such as java.util.Scanner and com.sun.eng

Example

 package com.dockertpoint; 
 class Student {  
    void shape(){
    // your code  
      } 
  } 


Constant

  • It should be written in capital letters.
  • Constants should have all capital letters and underscores ("_") between words.
  • Constant may contain digits but not as the first letter.

Example

 package com.dockertpoint; 
 class Student {  
    static final int MAX_FEE = 1800;
    // your code  
  } 


Naming Convention use in java

Instead than naming Java classes, variables, and methods at random, it is best practise to give them names that reflect what they are intended to achieve. The Java programming language's name standards are listed here. For excellent maintenance and readability of code, they must be complied with when creating Java programme. Java follows the CamelCase convention when naming methods, variables, classes, packages, and constants.


Java Control Statement Next »
« Perv Next »


Post your comment





Read Next Topic
Java Tutorial - Topic
What is Java
History of Java
Freature of Java
Difference Between Java & C++
Java Environment Set Up
Java Hello World Program & its Internal Process
JDK, JRE and JVM
Java Variables
Java Data Types & Unicode System
Java Operators
Java Keywords
Java Naming Convention
Read Other Java Chapter
Java Topic
Java Basic Tutorial
Java Control Statements
Java Classes & Object
Java Inheritance
Java Polymorphism
Java Abstraction
Java Encapsulation
Java OOPs Miscellaneous
Java Array
Java String
Java Exception Handling
Java Multithreading
Java Synchronization
Java Applet
Java 8 Features
Java 9 Features
Java Collection
Java Mcq
Java Interview Question
Tools
  

Useful Links

  • Home
  • Blog
  • About us
  • Contact Us
  • Privacy policy

Contact Us

Police Colony
Patna, Bihar
India

Email:

About DockerTpoint


India's largest site for Programming Tutorial as well as BANK, SSC, RAILWAY exam
and Campus placement preparation.